<?php
//检查当前是否已经登录
session_start();
$remember = $_POST['remember'];
if($remember){
    //表明是检查是否保存登录
    $rememberMe = $_COOKIE['rememberMe'] ?? '';
    if($rememberMe){
        //说明保存 登录状态
        $username = $_COOKIE['username'];
        include_once 'conn.php';
        $data = new Bbs();
        $result = $data->checkLogin($username);
        echo json_encode($result);
    }
    else{
        $a['code'] = 0;
        echo json_encode($a);
    }
}
else{
    //表明是检查当前是否已经处于登录状态
    if($_SESSION['loggedUserID'] ?? ''){
        //说明已经登录了
        include_once 'conn.php';
        $data = new Bbs();
        $result = $data->checkLogin($_SESSION['loggedUsername']);
        echo json_encode($result);
    }
    else{
        $a['code'] = 0;
        echo json_encode($a);
    }
}




/**/